<extend name="Public/baseConf"/>
<block name="breadcrumb"> 
	<div class="row wrapper border-bottom white-bg page-heading">
	    <div class="col-lg-4">
	        <h2>模型列表</h2>
	        <ol class="breadcrumb">
	            <li><a href="{:U('index/index')}">首页</a></li>
	            <li class="active">
	                <strong>模型列表</strong>
	            </li>
	        </ol>
	    </div>
	    <div class="col-lg-8">
            <div class="title-action">
				<span class="block pull-right">
					<a class="btn btn-primary" href="{:U('Model/add')}">
						<i class="fa fa-pencil align-top"></i>新增
					</a>
					<button class="btn btn-primary btn-success ajax-post" url="{:U('Model/setStatus',array('status'=>1))}" target-form="ids">
						<i class="fa fa-flag"></i>启用
					</button>
			        <button class="btn ajax-post" url="{:U('Model/setStatus',array('status'=>0))}" target-form="ids">
						<i class="fa fa-flag"></i>禁用
					</button> 
			        <button class="btn btn-warning ajax-post" url="{:U('Model/generate')}" target-form="ids">
						<i class="fa fa-trash align-top"></i>生成
					</button>
				</span>
            </div>
        </div>
	</div>
</block>
<block name="body">
	<div class="row">
            <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>模型列表</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <div class="table-responsive">
                    <form class="ids">
		                  <table class="table table-striped table-bordered table-hover dataTables-example" >
			                  <thead>
			                  <tr>
									<th class="row-selected row-selected">
									<label><input type="checkbox" class="check-all" /><span class="lbl"></span></label></th>
									<th>编号</th>
									<th>标识</th>
									<th>名称</th>
									<th>创建时间</th>
									<th>状态</th>
									<th>操作</th>
									<th></th>
			                  </tr>
			                  </thead>
			                  <tbody>
									<notempty name="_list">
									<volist name="_list" id="vo">
									<tr>
							            <td class="center">
											<label>
												<input type="checkbox" class="ids" name="id[]" value="{$vo.id}"/>
												<span class="lbl"></span>
											</label></td>
										<td>{$vo.id} </td>
										<td>{$vo.name}</td>
										<td><a data-id="{$vo.id}" href="{:U('model/edit?id='.$vo['id'])}">{$vo.title}</a></td>
										<td><span>{$vo.create_time|time_format}</span></td>
										<td>{$vo.status_text}</td>
										<td>
											<a href="{:U('think/lists?model='.$vo['name'])}">数据</a>
											<a href="{:U('model/setstatus?ids='.$vo['id'].'&status='.abs(1-$vo['status']))}" class="ajax-get">{$vo.status|show_status_op}</a>
											<a href="{:U('model/edit?id='.$vo['id'])}">编辑</a>
											<a href="{:U('model/del?ids='.$vo['id'])}" class="confirm ajax-get">删除</a>
							            </td>
							            <td></td>
									</tr>
									</volist>
									<else/> 
									<td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
									</notempty>
			                  </tbody>
		                  </table>
		            </form>
		            <div class="page pull-right">
				     	{$_page}
			 		</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
    <script type="text/javascript">
    $(function(){
    	$("#search").click(function(){
    		var url = $(this).attr('url');
    		var status = $('select[name=status]').val();
    		var search = $('input[name=search]').val();
    		if(status != ''){
    			url += '/status/' + status;
    		}
    		if(search != ''){
    			url += '/search/' + search;
    		}
    		window.location.href = url;
    	});
})
</script>
</block>
